﻿<!DOCTYPE html>
<html ng-app="app" ng-controller="LayoutCtrl">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <title>{siteName}</title>
    <link href="/content/libs/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <link href="/content/app/app.css" rel="stylesheet">
</head>
<body lang="en">
    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="navbar-header">
            <span class="navbar-brand">{siteName}</span>
        </div>
        <ul class="nav navbar-nav" ng-show="model.currentUser" ng-cloak>
            <li class="dropdown">
                <a href="#" class="dropdown-toggle" data-toggle="dropdown">{{model.currentUser}} <b class="caret"></b></a>
                <ul class="dropdown-menu">
                    <li><a href="{{model.logoutUrl}}">Logout</a></li>
                    <li class="divider" ng-show="model.loginWithDifferentAccountUrl"></li>
                    <li><a href="{{model.loginWithDifferentAccountUrl}}" ng-show="model.loginWithDifferentAccountUrl">Login With Different Account</a></li>
                </ul>
            </li>
        </ul>
    </div>

    <div class="container">
        <div class="page-header">
            <h1>This is a custom view</h1>
        </div>
    </div>

    <div class='container page-permissions' ng-cloak>
        <div class="row page-header">
            <div class="col-sm-10">
                <h1>
                    Client Application Permissions
                </h1>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-8">
                <div ng-show="model.errorMessage" class="alert alert-danger">
                    <strong>Error:</strong>
                    {{model.errorMessage}}
                </div>
            </div>

            <div class="col-sm-8" ng-hide="model.clients">
                <div class="alert alert-info">
                    You have not given permission to any applications
                </div>
            </div>
        </div>

        <div class="permissions">
            <div ng-repeat="client in model.clients" class="row permission">
                <div class="col-sm-2">
                    <img ng-src="{{client.clientLogoUrl}}">
                </div>
                <div class="col-sm-8">
                    <div class="permission-clientname">{{client.clientName}}</div>
                    <div ng-show="client.identityPermissions">
                        <div class="permission-type">Identity Permissions</div>
                        <ul>
                            <li ng-repeat="permission in client.identityPermissions" ng-bind="permission.displayName"></li>
                        </ul>
                    </div>
                    <div ng-show="client.resourcePermissions">
                        <div class="permission-type">Resource Permissions</div>
                        <ul>
                            <li ng-repeat="permission in client.resourcePermissions" ng-bind="permission.displayName"></li>
                        </ul>
                    </div>
                </div>
                <div class="col-sm-2">
                    <form name="form" method="post" action="{{model.revokePermissionUrl}}" class="consent-form">
                        <anti-forgery-token token="model.antiForgery"></anti-forgery-token>
                        <input type="hidden" name="clientId" value="{{client.clientId}}">
                        <button class="btn btn-danger">Revoke Access</button>
                    </form>
                </div>
            </div>
        </div>
    </div>

    <script id='modelJson' type='application/json'>
        {model}
    </script>
    <script src="/content/libs/jquery/jquery-1.11.0.min.js"></script>
    <script src="/content/libs/bootstrap/js/bootstrap.min.js"></script>
    <script src="/content/libs/angular/angular.1.2.13.min.js"></script>
    <script src="/content/libs/encoder/encoder.min.js"></script>
    <script src="/content/app/app.js"></script>
</body>
</html>
